/**
 * This file is part of 1genia trampoline
 * Copyright (C) 2007 1genia (contact@1genia.com)
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; version 3 of the License. 
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details. 
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; see the file COPYING.TXT.  If not,
 * write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301, USA. 
 **/
package com.genia.toolbox.web.gwt.basics.client.widget;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Image;

/**
 * print a link to an url.
 */
public class ImageExternalHyperLink
    extends ExternalHyperLink
{

  /**
   * the wrapped image.
   */
  private final Image image = new Image();



  /**
   * constructor.
   */
  public ImageExternalHyperLink()
  {
    super();
    add(image);
  }



  /**
   * constructor.
   * 
   * @param url
   *          the href of the &lt;a&gt; element
   */
  public ImageExternalHyperLink(String url)
  {
    super(url);
    add(image);
  }



  /**
   * constructor.
   * 
   * @param url
   *          the href of the &lt;a&gt; element
   * @param target
   *          the target of the &lt;a&gt; element
   */
  public ImageExternalHyperLink(String url, String target)
  {
    super(url, target);
    add(image);
  }



  /**
   * returns the HTML to display in the link.
   * 
   * @return the HTML to display in the link
   * @see com.genia.toolbox.web.gwt.basics.client.widget.ExternalHyperLink#getInnerHTML()
   */
  protected String getInnerHTML()
  {
    System.err.println("getInnerHTML: " + DOM.getInnerHTML(image.getElement()));
    return DOM.getInnerHTML(image.getElement());
  }



  /**
   * set the title of the image.
   * 
   * @param title
   *          the title of the image
   * @see com.google.gwt.user.client.ui.UIObject#setTitle(java.lang.String)
   */
  public void setImageTitle(String title)
  {
    image.setTitle(title);
  }



  /**
   * set the url of the image.
   * 
   * @param url
   *          the url of the image
   * @see com.google.gwt.user.client.ui.Image#setUrl(java.lang.String)
   */
  public void setImageUrl(String url)
  {
    image.setUrl(url);
  }

}
